STRTOK

Section: C Library Functions (3)
Index Return to Main Contents

BSD mandoc
BSD 3  

NAME

strtok strsep - string token operations  

SYNOPSIS

Fd #include <string.h> Ft char * Fn strtok char *str const char *sep  

DESCRIPTION

Bf -symbolic This interface is obsoleted by strsep(3). Ef

The Fn strtok function is used to isolate sequential tokens in a null-terminated string, Fa str . These tokens are separated in the string by at least one of the characters in Fa sep . The first time that Fn strtok is called, Fa str should be specified; subsequent calls, wishing to obtain further tokens from the same string, should pass a null pointer instead. The separator string, Fa sep , must be supplied each time, and may change between calls.

The Fn strtok function returns a pointer to the beginning of each subsequent token in the string, after replacing the separator character itself with a NUL character. When no more tokens remain, a null pointer is returned.  

SEE ALSO

index(3), memchr(3), rindex(3), strchr(3), strcspn(3), strpbrk(3), strrchr(3), strsep(3), strspn(3), strstr(3)  

STANDARDS

The Fn strtok function conforms to St -ansiC .  

BUGS

There is no way to get tokens from multiple strings simultaneously.

The System V Fn strtok , if handed a string containing only delimiter characters, will not alter the next starting point, so that a call to Fn strtok with a different (or empty) delimiter string may return a non- NULL value. Since this implementation always alters the next starting point, such a sequence of calls would always return NULL


 

Index

NAME
SYNOPSIS
DESCRIPTION
SEE ALSO
STANDARDS
BUGS

This document was created by man2html, using the manual pages.
Time: 16:28:56 GMT, April 18, 2022